package com.ylr.admin.framework.controller.api;

import com.ylr.base.common.po.user.UserAuthenticationDto;
import com.ylr.base.common.tool.Result;
import com.ylr.admin.framework.feign.YaUserBaseClient;
import com.ylr.admin.framework.service.UserAuthService;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-05-11 17:10:12
 * className: UserApiController
 * version: 1.0
 * description:
 */
@RestController
@RequestMapping("/api/user")
@AllArgsConstructor
public class UserApiController implements YaUserBaseClient {

    private static final Logger log = LoggerFactory.getLogger(UserApiController.class);

    private final UserAuthService userAuthService;

    /**
     * 获取用户认证数据接口
     * @param userId 用户主键
     * @return 用户关联的系统接口数据
     */
    @GetMapping("/get/authentication")
    public Result<UserAuthenticationDto> getAuthentication(@RequestParam("userId") Long userId) {
        log.info("api => 开始获取用户关联的’系统接口‘操作。userId={}", userId);

        UserAuthenticationDto userAuthenticationDto = userAuthService.getAuthentication(userId);

        log.info("api => 获取用户关联的’系统接口‘操作结束。{}", userAuthenticationDto);
        return Result.success(userAuthenticationDto);
    }
}
